// 1979 Recoding

global keepers1979 ""

numlabel, add

genl id=_n
global keepers1979 $keepers1979 id

genl year=1979
global keepers1979 $keepers1979 year

genl wt=1
global keepers1979 $keepers1979 wt

genl income=m212284
recode income 0 88=.
genl income3=income
centile income, c(33 66 100)
replace income3=0 if income<=r(c_1)
centile income, c(33 66 100)
replace income3=1 if income>r(c_1) & income<=r(c_2)
centile income, c(33 66 100)
replace income3=2 if income>r(c_2) & income<=r(c_3)
global keepers1979 $keepers1979 income3

genl pid_ce=m129156
recode pid_ce 2=1 1 2/8=0
global keepers1979 $keepers1979 pid_ce

genl vote_ce=m115147
recode vote_ce 0=. 2=1 1 3/8=0
global keepers1979 $keepers1979 vote_ce

genl turnout=m114145
recode turnout 5 8=0
global keepers1979 $keepers1979 turnout


// Campaign Interest

codebook m000008
gen intcampnew = m000008
recode intcampnew 8=2.5 0=. 
replace intcampnew=(abs(intcampnew-4))/3
tab intcampnew m000008
label variable intcampnew "campaing interest new"
label define campinterest 1 "1=high interest"
label values intcampnew campinterest
tab m000008 intcampnew
global keepers1979 $keepers1979 intcampnew

gen ptyworknew = m000017
recode ptyworknew 1=1 0=0
label variable ptyworknew "worked for party new"
label define ptywrk 1 "1=worked for party" 
label values ptyworknew ptywrk
tab m000017 ptyworknew
global keepers1979 $keepers1979 ptyworknew

gen ptyworknew1979 = m000018
recode ptyworknew1979 1=1 0=0
label variable ptyworknew1979 "worked for party new (1979)"
label values ptyworknew1979 ptywrk
tab m000018 ptyworknew1979
global keepers1979 $keepers1979 ptyworknew1979

codebook m127027
gen talkedaboutnew = m127027
recode talkedaboutnew 8=2 0=. 
replace talkedaboutnew=(abs(talkedaboutnew-3))/2
label variable talkedaboutnew "talked with others new"
label define talked 1 "1=talked to others"
label values talkedaboutnew talked
tab m127027 talkedaboutnew
global keepers1979 $keepers1979 talkedaboutnew

codebook m024061
gen intpolsnew = m024061
recode intpolsnew 8=2.5 0=. 
replace intpolsnew=(abs(intpolsnew-4))/3
label variable intpolsnew "interest in pols"
label define interest 1 "1=high interest"
label values intpolsnew interest
tab m024061 intpolsnew
global keepers1979 $keepers1979 intpolsnew


// Ideology

codebook m000081
gen taxspendnew = m000081
recode taxspendnew 8=4 0=. 
gen flipts = 7-taxspendnew
tab flipts
replace flipts=(abs(flipts-6))/6
replace taxspendnew = flipts
drop flipts
tab taxspendnew m000081
label variable taxspendnew "social spending new"
label define spend 1 "1=pro-spending" 
label values taxspendnew spend
tab m000081 taxspendnew
global keepers1979 $keepers1979 taxspendnew

codebook m000091
gen unemployspendnew = m000091
recode unemployspendnew 8=4 0=. 9=.
gen flipts = 7-unemployspendnew
tab flipts
replace flipts=(abs(flipts-6))/6
replace unemployspendnew = flipts
drop flipts
tab unemployspendnew m000081
label variable unemployspend "tackle unemploymet by spending new"
label values unemployspend spend
tab m000091 unemployspend
global keepers1979 $keepers1979 unemployspendnew

codebook m000201
gen unionregnew = m000201
recode unionregnew 8=4 0=.
replace unionregnew=(abs(unionregnew-7))/6
tab m000201 unionregnew
label variable unionregnew "gov't regulation of unions new"
label define reg 1 "1=increase regulation"
label values unionregnew reg
tab m000201 unionregnew
global keepers1979 $keepers1979 unionregnew

gen stateownnew = m073086
recode stateownnew 8=2.5 0=.
replace stateownnew = (abs(stateownnew-4))/3
label variable stateownnew "nationalisation new"
label define natnlown 1 "1=pro-nationalisation"
label values stateownnew natnlown
tab m073086 stateownnew
global keepers1979 $keepers1979 stateownnew

codebook m469137
gen povertyspendnew = m469137
recode povertyspendnew 8=3 0=. 
replace povertyspendnew=(abs(povertyspendnew-5))/4
label variable povertyspendnew "gov't spending on poverty reduction"
label values povertyspendnew spend
tab m469137 povertyspendnew
global keepers1979 $keepers1979 povertyspendnew

codebook m470138
gen redistributenew = m470138
recode redistributenew 8=3 0=. 
replace redistributenew=(abs(redistributenew-5))/4
label variable redistributenew "gov't redistribution new"
label define redistrib 1 "1=pro-redistribution new"
label values redistributenew redistrib
tab m470138 redistributenew
global keepers1979 $keepers1979 redistributenew

codebook m080076
gen benefitspendnew = m080076
recode benefitspendnew 8=2.5 0=. 9=.
gen flipwelf = 5-benefitspendnew
replace flipwelf=(abs(flipwelf-4))/3
replace benefitspendnew = flipwelf
drop flipwelf
tab benefitspendnew m080076
label variable benefitspendnew "benefit spending new"
label values benefitspendnew spend
tab m080076 benefitspendnew
global keepers1979 $keepers1979 benefitspendnew

codebook m458095
gen welfarespendnew = m458095
recode welfarespendnew 8=3 0=. 9=.
gen flipwelf = 6-welfarespendnew
replace flipwelf=(abs(flipwelf-5))/4
replace welfarespendnew = flipwelf
drop flipwelf
tab welfarespendnew m458095
label variable welfarespendnew "welfare spending new"
label values welfarespendnew spend
tab m458095 welfarespendnew
global keepers1979 $keepers1979 welfarespendnew

gen buspowernew = m491180
recode buspowernew 1=1 5=0 8=.5 0=.
label variable buspowernew "business power new"
label define powers 1 "1=too much power"
label values buspowernew powers
tab buspowernew m491180
global keepers1979 $keepers1979 buspowernew

gen unionpowernew = m490179
recode unionpowernew 1=1 5=0 8=.5 0=.
label variable unionpowernew "union power new"
label values unionpowernew powers
tab unionpowernew m490179
global keepers1979 $keepers1979 unionpowernew



// Class/occupation

// Assuming that husband is "head of household"
*gen class_head_grade = 
*recode class_head_grade 0=.
label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
*global keepers1979 $keepers1979 class_head_grade

gen class_resp_grade = m262295
recode class_resp_grade 0=.
label values class_resp_grade LblClassGrade
global keepers1979 $keepers1979 class_resp_grade

gen class_spou_grade = m268299
recode class_spou_grade 0=.
label values class_spou_grade LblClassGrade
global keepers1979 $keepers1979 class_spou_grade

gen male = m199288
recode male 1=1 5=0
global keepers1979 $keepers1979 male

gen married = m200262
recode married 1=0 2=0 3=0 4=1 5=0
global keepers1979 $keepers1979 married

gen unionmem_resp = m245190
recode unionmem_resp 1=1 5=0 8=0
global keepers1979 $keepers1979 unionmem_resp




// Economic perceptions

gen econ_ego_retro = m154a125
replace econ_ego_retro = . if econ_ego_retro == 8
replace econ_ego_retro = econ_ego_retro - 1
global keepers1979 $keepers1979 econ_ego_retro
